package 剑指offer;

import org.junit.Test;


public class _62圆圈中最后剩下的数字 {
	@Test
	public void test() {
		System.out.println(lastRemaining(5,3));
	}
	  public int lastRemaining(int n, int m) {
		int f=0;
		for (int i = 2; i <= n; i++) {
			f = (f+m)%i;
		}
		
		return f;
	    }

}
